'use strict';

const Controller = require('egg').Controller;

class userController extends Controller {
  async login() {
    const {ctx,service} = this
    const {name,pwd} = ctx.request.body;
    const res = await service.user.login(name,pwd);
    if(res.length>0){
      ctx.body = {
        code:200,
        msg:"登录成功",
        token:123
      }
    }else{
      ctx.body = {
        code:401,
        msg:"登录失败，用户名或密码错误",
      }
    }
  }
}

module.exports = userController;
